package com.bw.zg3park2212.repair

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.RepairAddParam
import com.bw.base.entity.RepairEntity
import com.bw.base.entity.RepairEntityItem
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class RepairViewModel@Inject constructor(val  apiService: ApiService): BaseViewModel() {
    val repairSuccse=MutableLiveData<RepairEntity>()
    fun repair(){
        httpRequst(
            {apiService.getRepair()},
            repairSuccse::postValue
        )
    }
    val repairNameSuccse=MutableLiveData<RepairEntity>()
    fun repairName(repairName:String){
        httpRequst(
            {apiService.getRepairName(repairName)},
            repairNameSuccse::postValue
        )
    }
    val repairCodeSuccse=MutableLiveData<RepairEntityItem>()
    fun repaircode(orderNumber:String){
        httpRequst(
            {apiService.getRepairCode(orderNumber)},
            repairCodeSuccse::postValue
        )
    }
    val repairAddSuccse=MutableLiveData<RepairEntityItem>()
    fun repairAdd(body:RepairAddParam){
        httpRequst(
            {apiService.getRepairAdd(body)},
            repairAddSuccse::postValue
        )
    }
    val repairDalSuccse=MutableLiveData<Boolean>()
    fun repairDal(id:Int){
        httpRequst(
            {apiService.getRepairDel(id)},
            repairDalSuccse::postValue
        )
    }
    val repairXiangSuccse=MutableLiveData<RepairEntityItem>()
    fun repairxiang(id:Int){
        httpRequst(
            {apiService.getRepairXiang(id)},
            repairXiangSuccse::postValue
            )
    }
    val repairUpSuccse=MutableLiveData<RepairEntityItem>()
    fun repairUp(id :Int,repairAddParam: RepairAddParam){
        httpRequst(
            {apiService.getRepairUp(id,repairAddParam)},
            repairUpSuccse::postValue
        )
    }
}